#include <iostream>  
#include <vector>  
#include <algorithm>  
#include <string>  
  
using namespace std;  
  
int main() {  
    vector<string> strings;  
    int choice;  
    string input;  
  
    while (true) {  
        cout << "1. 输入新的字符串\n";  
        cout << "2. 显示所有字符串\n";  
        cout << "3. 显示排序后所有字符串\n";  
        cout << "4. 退出程序\n";  
        cout << "选择操作：";  
        cin >> choice;  
  
        switch (choice) {  
            case 1:  
                cout << "请输入字符串：";  
                cin >> input;  
                strings.push_back(input);  
                break;  
            case 2:  
                cout << "所有字符串：" << endl;  
                for (size_t i = 0; i < strings.size(); ++i) {  
                    cout << i + 1 << ". " << strings[i] << endl;  
                }  
                break;  
            case 3:  
                sort(strings.begin(), strings.end());  
                cout << "排序后所有字符串：" << endl;  
                for (size_t i = 0; i < strings.size(); ++i) {  
                    cout << i + 1 << ". " << strings[i] << endl;  
                }  
                break;  
            case 4:  
                return 0;  
            default:  
                cout << "无效输入，请重新选择。" << endl;  
        }  
    }  
  
    return 0;  
}
